#ifndef WIDGET_H
#define WIDGET_H

#include <QWidget>
#include <QThreadPool>
#include <QtConcurrent>
#include "qthreadrun.h"
#include "qmovetothread.h"
#include "qrunnablerun.h"

QT_BEGIN_NAMESPACE
namespace Ui { class Widget; }
QT_END_NAMESPACE

class Widget : public QWidget
{
    Q_OBJECT

public:
    Widget(QWidget *parent = nullptr);
    ~Widget();

    void initThread();

    void setSwitch(bool flag);
    void myQtConcurrentRun();
    void myMainRun();

signals:
    void signal_moveToThread();

private slots:
    void on_pb_start_clicked();
    void on_pb_stop_clicked();
    void on_pb_start_2_clicked();
    void on_pb_stop_2_clicked();
    void on_pb_start_3_clicked();
    void on_pb_stop_3_clicked();
    void on_pb_start_4_clicked();
    void on_pb_stop_4_clicked();
    void on_pb_test_clicked();

private:
    Ui::Widget *ui;

    //QThreadRun
    QThreadRun *m_QThreadRun;

    //QMoveToThread
    QThread *m_QThread;
    QMoveToThread *m_QMoveToThread;

    //QRunnableRun
    QThreadPool *m_QThreadPool;
    QRunnableRun *m_QRunnableRun;

    //QtConcurrentRun
    bool startFlag;

};
#endif // WIDGET_H
